<template>
    <div>
        <el-form :inline="true" :model="formInline" class="demo-form-inline">
  <el-form-item label="请选择项目">
    <el-select v-model="formInline.houseList.hid" value-key="hid" @change="change">
     <el-option v-for="item in formInline.houseList" :label="item.hname" :value="item.hid" :key="item.hid"></el-option>
   </el-select>
  </el-form-item>
  <el-form-item label="请选择楼栋">
   <el-select v-model="formInline.buildList.buildingid" value-key="bid">
     <el-option v-for="item in formInline.buildList" :label="item.buildingname" :value="item.buildingid" :key="item.buildingid"></el-option>
   </el-select>
</el-form-item>

  <el-form-item>
    <el-button type="primary" @click="onSubmit">下一步</el-button>
  </el-form-item>
</el-form>
    </div>
</template>
<script>
export default {
    name:"roomManager",
    data(){
        return{
            formInline:{
            houseList:"",
            buildList:""
            }
         
        }
    },
    mounted () {
        this.showAllHouse();
    },
    methods:{
        showAllHouse(){
  var the = this;
            this.sa.ajax("/buildManager/listAllNoPage",
            null,
            function(data){
                the.formInline.houseList = data.data;
            }.bind(this)
            )
        },
      
        onSubmit(){
          var tab = {id: 'roomListPage', name: '分户信息', view: () => import('@/sa-view/WmtbuildManager/roomListPage.vue'), params:{
            hid:this.formInline.houseList.hid,
            buildingid:this.formInline.buildList.buildingid
          }};
            this.sa_admin.showTab(tab);
        },
        change(){
        if(this.formInline.houseList.hid){
          this.toLoad(this.formInline.houseList.hid)
        }
        },
        toLoad(value){
          var the = this;
            this.sa.ajax("/building/listAll",
            {
              "hid":value
            },
            function(data){
                the.formInline.buildList = data.data;
            }.bind(this)
            )
        }
    }
}
</script>
